<template>
  <el-dialog
    v-el-drag-dialog
    title="复核检查"
    :visible.sync="visible"
    width="800px"
    append-to-body
    @closed="reset"
  >
    <el-form label-position="right">
      <el-form-item label="处理结果：" label-width="90px">
        <el-select v-model="status" placeholder="请选择">
          <el-option key="ok" label="通过" :value="2" />
          <el-option key="no" label="不通过" :value="3" />
        </el-select>
      </el-form-item>
      <el-form-item class="remark" label="备注：" label-width="90px">
        <el-input
          v-model="remark"
          type="textarea"
          :rows="3"
          placeholder="请输入内容"
        />
      </el-form-item>
    </el-form>

    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="confirm()">
        确定
      </el-button>
      <el-button @click="visible = false">
        关闭
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
  import { recheckUpdateStatus } from '@/api'
  export default {
    name: 'reCheck',
    props: {
      parentFetchData: {
        type: Function
      }
    },
    data() {
      return {
        visible: false,
        status: 2,
        remark: ''
      }
    },
    methods: {
      open(codes) {
        this.codes = codes
        this.status = 2
        this.remark = ''
        this.visible = true
      },
      confirm() {
        const query = {
          codes: this.codes,
          status: this.status,
          remark: this.remark
        }
        recheckUpdateStatus(query).then(res => {
          if (res.status) {
            this.visible = false
            this.$message.success('操作成功')
            this.parentFetchData({})
          }
        })
      },
      reset() {
      }
    }
  }
</script>
<style lang="scss" scoped>
.remark {
  display: flex;
  & /deep/ .el-form-item__content {
    width: 100%;
    margin-left: 0 !important;
  }
}
</style>
